/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package AplicacionMVC;


import java.awt.Dimension;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.GridBagLayout;
import java.awt.Toolkit;
import java.sql.SQLException;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.WindowConstants;

/**
 *
 * @author Jesus Ruiz Oliva
 */
public class HouseApplication {
   static private GraphicsEnvironment ge =GraphicsEnvironment.getLocalGraphicsEnvironment();
   static private GraphicsDevice gd = null;

    public static void main (String[] arg) throws SQLException{
        /*try {
            UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(HouseApplication.class.getName()).log(Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            Logger.getLogger(HouseApplication.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            Logger.getLogger(HouseApplication.class.getName()).log(Level.SEVERE, null, ex);
        } catch (UnsupportedLookAndFeelException ex) {
            Logger.getLogger(HouseApplication.class.getName()).log(Level.SEVERE, null, ex);
        }*/
        
        ModeloMedicos modeloMedico = new ModeloMedicos();
        ModeloPacientes modeloPaciente = new ModeloPacientes();
        ModeloFormulario modeloFormulario = new ModeloFormulario();
        JFrame frame= new JFrame("Gestion de Centro Hospitalario");
        JPanel conteiner = new JPanel();
        conteiner.setLayout(new GridBagLayout());
        Vistas panel = new Vistas();
        Toolkit tk = Toolkit.getDefaultToolkit();
        Dimension tamaño = tk.getScreenSize();
        panel.setSize(tamaño);       
        panel.repaint();
        frame.add(panel);
        frame.pack();
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);        
        frame.setSize(tamaño);
        frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
        //gd = ge.getDefaultScreenDevice();
        //gd.setFullScreenWindow(frame);
        frame.setVisible(true);        
        
        //creamos el objeto controlador de eventos
        Controller control= new Controller(panel,modeloMedico,modeloPaciente,modeloFormulario);
        panel.addButtonListener(control);
        panel.addMouseListener(control.getMouserAdapter());
        panel.addMouseListenerListaCitas(control.getMouseAdapterListaCitas());
        panel.addMouseListenerListaCambiarMotivo(control.getMouserAdapterCambiarMotivo());
        panel.addMouseListenerListaAgregarAlergia(control.getMouserAdapterAgregarAlergia());
        panel.addMouseListenerListaAgregarDiscapacidad(control.getMouserAdapterAgregarDiscapacidad());
        panel.addMouseListenerTablaHistorialDiagnosticos(control.getMouseAdapterListaDiagnosticos());
        panel.addMouseListenerTableMedicinas(control.getMouseAdapterTableMedicinas());
        panel.addMouseListenerES(control.getMouserAdapterES());
        panel.addMouseListenerUS(control.getMouserAdapterUS());
        //panel.addMouseListenerListaPruebas(control.getMouserAdapterSolicitarPrueba());
    }    
}
